﻿@model ArticleModel
<i-form ref="form" v-model="submitting" action="@Model.SubmitUrl" class="am-form-h box box-form" @@success="submitSuccess" @@progress="submitProgress">
    <input type="hidden" name="Id" id="article_id" value="" />
    <input type="hidden" name="MenuId" id="article_mid" value="@Model.MenuId" />
    @if (Model.IsArticle)
    {
        @if (Model.ShowFastLoadingModule)
        {
            <div class="am-form-group">
                <div class="am-input-group" style="width:100%">
                    <input type="text" ref="article_load_url" placeholder="输入网址快速加载文章..." />
                    <span class="am-input-group-btn">
                        <i-button skin="primary" icon="cloud-download" :loading="loading" v-on:click="handleLoadArticle">加载</i-button>
                    </span>
                </div>
            </div>
        }
        <div class="am-form-group">
            <editor ref="content" name="Content" style="width:100%;height:300px" @@on-ready="editorReady" @@change="handleEditorChange" required></editor>
        </div>
    }
    else
    {
        @if (Model.ShowFastLoadingModule)
        {
            <form-item label="外部文章">
                <div class="am-input-group" style="width:100%">
                    <input type="text" ref="article_load_url" placeholder="输入网址快速加载文章..." />
                    <span class="am-input-group-btn">
                        <i-button skin="primary" icon="cloud-download" :loading="loading" v-on:click="handleLoadArticle">加载</i-button>
                    </span>
                </div>
            </form-item>
        }
        @await Html.PartialAsync("_FormBuilder", new FormBuilderModel(Model.Menu.Config, "article"))
    }
    <div class="am-text-center am-padding-top-sm" id="article_bar">
        <a class="am-btn am-btn-default" style="margin-right:20px;" @@click="newArticle()">新建</a>
        <a class="am-btn am-btn-default" style="margin-right:20px;padding:8px 30px" @@click="preview()">预览</a>
        <i-button type="submit" skin="primary" :loading="submitting" style="padding:8px 40px;margin-right:10px">确认发布</i-button>
        @*<input type="submit" value="确认发布" class="am-btn am-btn-primary" style="" id="article_btn_submit" />*@
        @if (!Model.ShowAudit)
        {
            <Checkbox checked name="publish" value="on">立刻发布</Checkbox>
        }
    </div>
</i-form>
<form id="article_form_preview" target="_blank" action="/article/preview" method="post" style="display:none">
    <input type="hidden" name="Title" />
    <input type="hidden" name="Intro" />
    <input type="hidden" name="Content" />
</form>